import React from 'react'
import Header from './Header'
import Footer from './Footer'

import Form from './common/From'
import Item from './common/Item'

export default class App extends React.Component{
    constructor(...arg){
        super(...arg)
        this.state={
            comments:[]
        }
    }


    render(){
        const {comments} = this.state;
        return(
           <div>
             <Header title={'基本的react配置'}/>
               <Form addcomments={this.addcomments}/>
               <h2 className='rename'>评论回复:</h2>
               <Item comments={comments} />
               <Footer footer={'我是底部'}/>
           </div>
        )
    }
    addcomments(comment){
       let {comments}= this.state;
        comments.unshift(comment)
        this.setState({
            comments
        })
    }
}